package com.datastructure.practice;

public class WaterColumn {
    public static void main(String[] args) {

    }
}

class Solution4 {
    public int maxArea(int[] height) {
        int i = 0;
        int j = height.length-1;
        int area = 0;
        while(i < j){
            if(height[i]>=height[j]){
                area = Math.max(area,(j-i)*height[j]);
                i++;
            } else {
                area = Math.max(area,(j-i)*height[i]);
                j--;
            }
        }
        return area;
    }
}
